package com.grape.juc.threadpool.callable;

import java.util.concurrent.*;

/**
 * 描述:callable
 * @author: myx
 * @date: 2019-05-08
 * Copyright © 2019-grape. All rights reserved.
 */
public class CallableTest {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService executorService = Executors.newCachedThreadPool();
        Future submit = executorService.submit(new TaskCallable());
        System.out.println(submit.get());
    }
}

class TaskCallable implements Callable{

    @Override
    public Object call() throws Exception {
        Thread.sleep(2000);
        return "call";
    }
}
